class LoginController < ApplicationController
  def login
      user = User.authenticate(params[:account], params[:password])
      if user
        session[:user_id] = user.id
        flash[:notice] = 'welcome'
      else
        flash[:notice] = 'Invaild account/password combination'
      end
      respond_to do |format|
        format.js
      end
  end


  def logout
    session[:user_id] = nil
    flash[:notice] = nil
    redirect_to(:controller =>"index")
  end
end
